home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 1122 / 1122.xpi / chrome / tabmixplus.jar / content / tabmixplus / pref / preferencesOverlay.js < prev    next >
Text File  |  2009-08-30  |  3KB  |  83 lines

  1. var gTabMix_preferencesOverlay = {
  2.    init: function gTabMix_preferencesOverlay_init(aEvent) {
  3.       var prefWindow = aEvent.target.documentElement;
  4.  
  5.       this.onPaneLoad(prefWindow.lastSelected);
  6.  
  7.       eval("prefWindow.showPane ="+prefWindow.showPane.toString().replace(
  8.         'this._outer._selectPane(this._pane);',
  9.         '$& \
  10.          gTabMix_preferencesOverlay.onPaneLoad(this._pane.id);'
  11.       ));
  12.    },
  13.  
  14.    onPaneLoad: function gTabMix_preferencesOverlay_onPaneLoad(aPaneID) {
  15.       switch (aPaneID) {
  16.          case "paneTabs":
  17.             this.loadOverlay();
  18.          break;
  19.          case "panePrivacy":
  20.             this.onPanePrivacyLoad();
  21.          break;
  22.          default:
  23.       }
  24.    },
  25.  
  26. /* ........ paneTabs .............. */
  27.    loadOverlay: function () {
  28.       function OverlayLoadObserver() { }
  29.       OverlayLoadObserver.prototype = {
  30.          _outer: this,
  31.          observe: function (aSubject, aTopic, aData) {
  32.             this._outer._afterOverlayLoaded();
  33.          }
  34.       };
  35.       var obs = new OverlayLoadObserver();
  36.       document.loadOverlay("chrome://tabmixplus/content/pref/tab_panel.xul", obs);
  37.  
  38.    },
  39.  
  40.    _afterOverlayLoaded: function () {
  41.       document.getElementById("_hideTabbar").value = document.getElementById("extensions.tabmix.hideTabbar").value;
  42.       document.getElementById("generalWindowOpen").value = document.getElementById("browser.link.open_newwindow").value;
  43.       var prfSV = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch2);
  44.       var singleWindowMode = prfSV.getBoolPref("extensions.tabmix.singleWindow");
  45.       if (singleWindowMode)
  46.          document.getElementById("linkTargetWindow").disabled = true;
  47.       if (document.getElementById('BrowserPreferences')._shouldAnimate)
  48.          window.sizeToContent();
  49.    },
  50.  
  51.    showTabmixOptions: function () {
  52.       var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
  53.                            .getService(Components.interfaces.nsIWindowMediator);
  54.       var browserWindow = windowMediator.getMostRecentWindow('navigator:browser');
  55.  
  56.       if (!browserWindow) {
  57.          var tabmixopt = windowMediator.getMostRecentWindow("mozilla:tabmixopt");
  58.          if (tabmixopt)
  59.             tabmixopt.close();
  60.  
  61.          var stringBundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
  62.                   .getService(Components.interfaces.nsIStringBundleService)
  63.                   .createBundle("chrome://tabmixplus/locale/tabmix.properties");
  64.          var title = stringBundle.GetStringFromName("tabmixoption.error.title");
  65.          var msg = stringBundle.GetStringFromName("tabmixoption.error.msg");
  66.  
  67.          var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
  68.                                     .getService(Components.interfaces.nsIPromptService);
  69.          promptService.alert(window, title, msg);
  70.       }
  71.       else
  72.          browserWindow.TMP_openDialog(-1);
  73.    },
  74.  
  75. /* ........ panePrivacy .............. */
  76.    onPanePrivacyLoad: function () {
  77.        var clearDataNow = document.getElementById("clearDataNow");
  78.        if (clearDataNow)
  79.           clearDataNow.setAttribute("oncommand", clearDataNow.getAttribute("oncommand") + " TMP_Sanitizer.tryToSanitize();");
  80.    }
  81.  
  82. }
  83.